package com.aizuda.boot.config.properties;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author hjw
 * @description 飞书对接配置类
 * @date 2025年06月24日 13:53
 */
@Component
@ConfigurationProperties(prefix = "feishu")
@Data

public class FeiShuConfigProperties {

    private Map<String, FeiShuAppConfig> apps;

    @Schema(description = "默认重定向地址")
    private String defaultRedirectUri;

    @Schema(description = "飞书审批回调地址")
    private String actionCallbackUrl;

    @Schema(description = "默认移动端重定向地址")
    private String defaultMobileRedirectUri;

    /**
     * 飞书应用配置
     */
    @Data
    @Schema(description = "租户配置信息")
    public static class FeiShuAppConfig {
        /**
         * 企业编号，平台内唯一
         */
        @Schema(description = "企业编号，平台内唯一")
        private String displayId;

        /**
         * 企业名称
         */
        @Schema(description = "企业名称")
        private String name;

        /**
         * 企业租户 ID
         */
        @Schema(description = "企业租户 ID")
        private String tenantKey;

        /**
         * 飞书应用 ID
         */
        @Schema(description = "飞书应用 ID")
        @JsonIgnore
        private String appId;
        /**
         * 飞书应用密钥
         */
        @Schema(description = "飞书应用密钥")
        @JsonIgnore
        private String appSecret;
        /**
         * 飞书重定向地址
         */
        @Schema(description = "飞书重定向地址")
        private String redirectUri;

        /**
         * 飞书模版配置
         */
        @Schema(description = "飞书模版配置")
        private Map<String,FeiShuTemplateConfig> templates;

    }

    @Data
    @Schema(description = "飞书发送模版配置")
    public static class FeiShuTemplateConfig {

        @Schema(description = "模版id")
        private String templateId;

        @Schema(description = "模版版本名称")
        private String templateVersionName;

        private List<String> businessScope;

        @Schema(description = "模版参数")
        private List<String> templateParams;
    }
}
